This is the top directory of the METAMODBASE module. It is part of the
METAMOD2 software (see ../README).

The METAMODBASE module is responsible for managing two METAMOD2 databases,
the Metadata database and the User database.

These databases can be shared between several METAMOD2 applications, but only one
of these applications will be using the METAMODBASE module (possibly together with
other METAMOD2 modules). The METAMODBASE module includes scripts for initializing
the databases, and for loading data into the Metadata database. The User database
can be updated also from other METAMOD2 modules.

An overview of the Metadata database tables is found in init/README. The ultimate 
documentation of these tables are found in the init/createdb.sh script. A similar
initalization script for the User database is userinit/createuserdb.sh. The User
database and an API for reading/writing to the database is found in the wiki page
https://wiki.met.no/metamod/user_database_revised.

For the Metadata database, the tasks performed by the METAMODBASE module are:

- Initialising the database. This is done by the init/create_and_load_all.sh
  script which sets up the database tables and load static data into some of the 
  tables. The actual work is done by two other scripts (activated by
  init/create_and_load_all.sh):

  init/createdb.sh               Defines all the tables in the database. 
  
  scripts/import_searchdata.pl   This script reads an XML file containing all
                                 the static data in the database. These data
                                 are loaded into the database.

- Importing datasets into the database from XML files. Each dataset is described
  by two XML files: <filename>.xmd and <filename>.xml. See README_XML for a
  detailed description. A dataset may also represent data that will be collected
  some time in the future. Other METAMOD2 modules have the responsibility of
  creating these XML files. 

  The script import_dataset.pl will read XML files and update the database
  accordingly. It is intended to run for long periods of time. It mostly
  sleeps, but wakes up at regular time intervals to check if any new or updated
  XML files are found in a set of directories given by the value of the IMORTDIRS 
  variable in the application configuration file (master_config.txt). The
  import_dataset.pl script is started from the 'metamodInit.sh start' command in the
  target directory. The script should be stopped using the corresponding
  'metamodInit.sh stop' command, which will stop the script in an orderly fashion.
  This software contain no tool for running this script (or other similar
  scripts) as a daemon or cronjob.

  The XML formats used for dataset import is documented in README_XML.
